/**
 * @param {number} mass
 * @param {number[]} asteroids
 * @return {boolean}
 */
 var asteroidsDestroyed = function(mass, asteroids) {
  asteroids.sort((a,b) => a-b)
  for(let x of asteroids){
    if(mass >= x) mass += x
    else return false  
  }  
  return true
};